﻿'功能說明：系統主網址 : 分為banner及mainPage1
'建立人員: andy
'建立日期：2011/2/4
'****************************************************
Imports System.Data
Imports System.Threading
Imports System.Globalization
Partial Class WebForm_Main_MainPage
    Inherits System.Web.UI.Page
    Public Sub RequestLogin()

         Response.Redirect("~/Login.aspx")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            'Session.Remove("txtClose")
            If Session("UID") = Nothing Then
                RequestLogin()
            End If
        Catch ex As Exception

            Dim logid As String = Context.User.Identity.Name
            logid = logid.Substring(logid.IndexOf("\") + 1)
            Response.Write(logid + ex.Message + ":User Not Found")
            Exit Sub
        End Try
        Dim path As String = ""
        If Request.QueryString.Count > 0 Then

            path = HttpUtility.UrlDecode(Request.QueryString.ToString()).Substring(5)
            Session("myURL") = Me.ResolveUrl(path)
            Response.Redirect(Me.Request.Url.AbsolutePath)
        End If

        Try
            Me.Title = GetLocalResourceObject("Title")
        Catch ex As Exception

        End Try



    End Sub
    Protected Overrides Sub InitializeCulture()

        Dim sl As String = GetUserLanguage()
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(sl)
        Thread.CurrentThread.CurrentUICulture = New CultureInfo(sl)
    End Sub
    Public Function GetUserLanguage() As String
        If IsNothing(Session("GlobalLanguage")) Then
            RequestLogin()
            Return Session("GlobalLanguage").ToString()
        Else
            Return Session("GlobalLanguage").ToString()
        End If

    End Function
End Class
